package net.xdclass.anno;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
//            <!--aop-->
//                    <dependency>
//                    <groupId>org.aspectj</groupId>
//                    <artifactId>aspectjweaver</artifactId>
//                    <version>1.8.7</version>
//                    </dependency>

import org.aspectj.lang.annotation.Pointcut;



import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class MyAnnotationAop {

    @Pointcut("@annotation(net.xdclass.anno.MyAnnotation)")
    private void pointcut(){

    }

    @Around(value="pointcut()")
    public Object aroud(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] args = joinPoint.getArgs();
        Object result = joinPoint.proceed(args);
        log.info("请求参数：{}",JSON.toJSON(args));
        log.info("返回结果：{}",JSON.toJSON(result));
        return result;
    }
}
